#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/types.h>

int main()
{
  printf("我是一个进程:%d\n",getpid());

  pid_t id = fork();
  if(id == 0)
  {

    //执行另一个程序
    execlp("ls","ls","-a","-l","-n",NULL);//程序替换函数
    exit(0);
  }

  wait(NULL);
  printf("代码运行中....\n");
  printf("代码运行中....\n");
  printf("代码运行中....\n");
  printf("代码运行中....\n");
  printf("代码运行中....\n");
  printf("代码运行中....\n");

  return 0;
}
